﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 * 买家账号：cwrrga5796@sandbox.com
 * 买家密码：111111
 * 
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
	

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000117624791";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC5z/L3cVfcSvcJhCn+DmmmwVtfkHC2yuz97oa22i0ad2gJg6dRrz7pf9aIb8T1Yj5fRQ2e0q6hhb9wZhyZpyEiR9GMKuckJ77+swqcsbWM8+5V3nXt7zoKk7Z20fOwL/u6oblPdVp0jO83SL9hr8lJWmRH8lQP0E2uK/LLmFE3bGt09W/uhQABn8fpFtIi5Xlb3CFRnt2hI8xFmzKnzLUybJLbMENuijnPwkLo9WyZsOG9eHj7fV7Eq24ffolRcK47QljNewQ75QMX+l62NjGpVz/6j7S3uMrebLM7IzlMagfgpgXvViJRMzB23SUm35D9DZ0xC2UR1p13hdBg3tf5AgMBAAECggEAFgP6gLDwPQywynLbWtuwTu63+dGuWSof/FJHqeCd2XXuYLo1l+sQpC/eZln/1yclxrnyzC+gO0kSjqm6l8YCmgIyZM4shs8ixSDHkBtKLII2afwqst9WXCx2QQvNOMHmrI0+3JhF+Gs+aKl464Udb1CDczbWGO2QVqOkZ9ULQmqlfDibzb50HVf3DmTvUtCIviQD++9PvC1mgtLgLJlii2zfbcS9HChe1YARRYRmGS2qhF+Oe8PD7E5iGeKKOWvDiyDgeT8u4Y0dOywDWPbcRF3mfgELac2Mr7uZ5XA9I/AJ1K8eN9RAK8oqeLyabXVBbP1n7bu+Y8qAUKPLDiIjgQKBgQDdj2nfNOeNc5M4w6dJzofrY9RyJZ1pAvxzrPw3WLfolA5g/P2ITtMkQ6l183jZ7H8K2pG294UVoWCR2FZZ+BPvWuO8Gj/RFEGuL82wAMsJkdEtDJ19zq8QNhXqpzNBz+jqWQOApSlBlO9nXm/sRgocji+dOo9J1kkL5hjNhf9bSQKBgQDWsgMsjid1Q9We3D76tJJzV1EZ05MWiu26Pce7EhqpthdqleSRF7AgyzOk+12pRhwwbWZAZ+wIHylI/8JXgYSr7FLBr8fnqnT8Nl4eNW2fIirBiJVckLd9XCOx1A55+Dqi7eeXwPpnNl5qWOkUSACltnrursoKK5mQzh3+7yRnMQKBgBsiJxsYxYrDLrJy85fMXUTskuXvyVlE7lnUQ4cbrFolV6V1Fi+NR7pXNvek+5XkqqJPpiy8H2ZIvyTdU6XtBbP4c49jv5EBZBHK9OurDTJ80xsrQlZX64SWuxRjqZlTtviMMiudDnJjpPYJ0Lck1LQujZI5y7aFMajtYvg4gs9RAoGBALJWxmoxXzd6dK10WGBatLhY1MZ2SF1WZCjrfsi3PiyxVHw2LNoVajmjca/fGast0OatSV3AtYD9mYbI5P9ZWAKT2R6IzK50mp6S7tV7Hics84U11pRAphrc+c2Sz7+jYdnLczBMnfQ0ZnNCjcJKGTeOAEnaKXwPQY3WmXYV4hBRAoGAZSe+kcKPW87fqaIWAvG13JrpNVPWTlwuDcXy3n0F/yVm8xQkGNEnC/hpBbA7QhtYxqb8W3EDwpb08jPl42W1lk0GG/5bA7q30cJKQkx+8u9vrcVeoizmAB4/s79QxkPfBpgLDvzUFaCXVbhwOGUssgZYztCwjuZNFnrus30du1s=";
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAj/L9fDu8NsllBoXe+tKNMkUQeqsIfAc2KNbPt4mYsznr5IqiiVKexVZpWIbbIc3NrIkPbySxNWdEZCCEBYoHo64R0Vu3UzH/TH7GJxEiM7+4a11M6I5MCmb15BfU8UUpmdhLJc8r8UbeD0sqNfSywrQ1YIONUCC+rbzH9VxAaejVMh6AvR76XBzVRvyvRrTew2Mmmh/UGRaDdY7QQnbZDCNqTK3oxg5uzb6gAoqbxAiiM3Wy8kC/MzwHgM5XMTbyJ3hGYLxxhKRwetoTwljJZSQzwKmrMb/YShecSbcvLvdsiRYKP4S7hdRO5tbyWDST3yu4PIkOeJYb7rilrvH80wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/flower/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

